<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>bind的实现</title>
</head>
<body>
	<script>
		/*
		*  bind方法应该在函数的原型中，fn.__proto__ === fn的构造函数的prototype,
		   所有的函数的构造函数都是Function;
		   Function 创建了Function,Function创建了Object
		   Function 创建了fn

		*/

		Function.prototype._bind = function(target,args) {
			return examples => {
				this.call(target,[...args,...examples])		
			}
		}

		fn.__proto__.bind = function() {

		}
		function fn(canshu) {
			console.log(this,canshu)
		}
		const fBind = fn._bind({name:'bindto'},[1111,2222])
		fBind([1,2,3])
	</script>
	<script>
		function testBind(mergeArgs) {
			console.log(mergeArgs)
		}
		var aaa = testBind.bind()
		console.log(aaa)
		// const bindFn = testBind.bind({name:'chengoub'},'binding')
		// console.log(bindFn)
		// bindFn('chenjiadagoubi')
	</script>
	

</body>
</html>